<template>
	<view class="template-business tn-safe-area-inset-bottom">
		<!-- 顶部自定义导航 -->
	<tn-nav-bar fixed alpha :isBack="true" >
		邀约报名表		
	</tn-nav-bar>
	
	
	
	
	<view class="tn-search-fixed" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
	  <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin">
	    <view class="justify-content-item align-content-item">
	      <view class="tn-bg-gray--light tn-flex tn-flex-col-center" style="border-radius: 100rpx;padding: 10rpx 20rpx 10rpx 20rpx;width: 100%;">
	        <text class="tn-icon-search justify-content-item tn-padding-right-xs tn-color-gray tn-text-lg"></text>
	        <input class="justify-content-item" placeholder="昵称" v-model="searchKey" placeholder-style="color:#AAAAAA" ></input>
	      </view>
	    </view>
	    
	    <view class="align-content-item">
	      <view class="justify-content-item tn-text-center" @click="sousuo()">
	        <tn-button fontColor="#000000" :shadow="true" backgroundColor="tn-main-gradient-yellow--reverse"   shape="round" padding="20rpx 20rpx" width="100rpx" shadow fontBold >
	          <text >搜索</text>
	        </tn-button>			
	      </view>
	    </view>
		
		
	  </view>
	</view>

		
		<mescroll-body ref="mescrollRef" @down="downCallback" @up="upCallback">
			
					<view class="tn-flex tn-flex-row-between tn-margin">
				<view>
					已报名{{baoming}}人
				</view>
					<view>
						已确认{{hexiao}}人
					</view>
				
					</view>
		<view class='nav-list tn-margin-bottom '  >
<block v-for="(item, index) in content" :key="index">
        <view class="article-shadow tn-margin">
          <view class="tn-flex">
            <view class="image-pic tn-margin-sm" :style="'background-image:url(' + item.avatar + ')'" @click="navigateToFn({ url: '/circleMixinPages/blogger_other?id='+item.user_id, checkLogin: false })">
              <view class="image-article">
              </view>
            </view>
            <view class="tn-margin-sm tn-padding-top-xs" style="width: 100%;">
              <view class="tn-text-bold clamp-text-1">
                {{ item.nickname }}
              </view>
              <view class="tn-padding-top-xs" style="min-height: 100rpx;">             
				<view class="  tn-color-gray clamp-text-2">
				 报名时间 {{ item.create_time }}
				</view>
              </view>
			  
              <view class="tn-flex tn-flex-row-between tn-flex-col-between">
                <view 
                  class="justify-content-item tn-tag-content__item tn-margin-right tn-round tn-text-sm tn-text-bold tn-bg-green--light tn-color-bule">
                  <text class="tn-tag-content__item--prefix" v-if="item.money>0">
					支付{{configInfo.site_moneyname}}{{item.money}}
				  </text>
				  <text class="tn-tag-content__item--prefix" v-else>
				  	免费
				  </text>
                </view>
                <view class="justify-content-item tn-color-red-text-center " style="padding-top: 5rpx;">
                  <text class=" tn-padding-right-xs " v-if="item.status==0">					
					未确认
				  </text>
                <text class=" tn-padding-right-xs " v-if="item.status==1">
                	已确认
                </text>
			
				
				</text>
				
                </view>
              </view>
            </view>
          </view>
        </view>
      </block>


		</view>
	</mescroll-body>


	</view>
</template>

<script>
	import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
	import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue';
	import MescrollUni from '@/components/mescroll-uni/mescroll-uni.vue';
	import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
	export default {
		name: 'TemplateGroup',
		mixins: [template_page_mixin, MescrollMixin],
		components: {
			MescrollBody
		},
		data() {
			return {
				ti_name:'',
				ti_kahao:'',
				searchKey:'',
				id:0,
				tixianshow:false,
				user_id:0,
				type: '',
				content: [],			
				orderno:'',	
				showma:false,	
				noinfo:[],
				ti_zhuangtai:0,
				baoming:0,
				hexiao:0,
				jine:0,
				time_is:false
			}
		},
		onLoad(option) {
			if (option.id) {
				this.id = option.id
			}
			if (option.type) {
				this.type = option.type
			}	
			
		},
		methods: {	
			
			async xiugairoom(){
				
			
				
				let that = this;
				if (this.jine<1){
					this.msg('金额不足1元无法提现');
					return
				}				
				
				if (this.ti_name==''||this.ti_kahao==''){
					this.msg('请填写完整姓名和账号');
					return
				}
				
				
				let result = await that.$request({
					loading: 1,
					method: 'post',
					url: '/chat/zuju/money_ti',
					data: {		  			
						ti_number:this.ti_kahao,
						ti_name:this.ti_name,					
						ti_money:this.jine,
						id:this.id
						
					}
				});
				if (result.statusCode == 200) {
					if (result.data.code == 200) {
						this.shezhishow=false
						this.msg('提现成功，等待审核')				
						this.mescroll.resetUpScroll()
						
					} else {
							uni.showToast({
								icon: 'none',
								title: result.data.msg
							});
						}
					} else {
						uni.showToast({
							icon: 'none',
							title: that.$errorMsg
						});
					}	
			},
			saoma(){
				let that=this
				uni.scanCode({
					onlyFromCamera: true,
					success: function (res) {
						that.chaxunno(res.result)						
					}
				});
			},			
			
			async chaxunno(no) {
				let that = this;
				let result = await that.$request({
					loading: 0,
					method: 'post',
					url: '/chat/zuju/getjoin',
					data: {
						no:no
					}
				})
				if (result.statusCode == 200) {
					if (result.data.code == 200) {
						that.noinfo=result.data.data
						that.showma=true
					}
					else{
						uni.showModal({
							title: '提示',
							content:result.data.msg,							
							success: function(res) {
								if (res.confirm) {
								
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
						
					}
				}
			},
			tixian(){
				console.log(this.time_is)
				if (this.time_is==false){
					this.msg('组局未结束不能提现');
					return
				}
				if (this.ti_zhuangtai==1){
					this.msg('已申请，请勿重复')
				   return
				}
				if (this.ti_zhuangtai==2){
					this.msg('已提现成功')
				   return
				}
				if (this.ti_zhuangtai==0){
					this.tixianshow=true
				   return
				}
				
			},
			tongyi(id,type,title){
				this.hexiao=false
				let that = this;
				uni.showModal({
					title: '提示',
					content:'你确定要'+title+'本次退款吗',							
					success: function(res) {
						if (res.confirm) {
							that.tongyipass(id,type)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},	
				
		async tongyipass(id,type){
				let that = this;
				let result = await that.$request({
					loading: 0,
					method: 'post',
					url: '/chat/zuju/tuipassfaqiren',
					data: {
						id:id,
						status:type
					}
				});				
				if (result.statusCode == 200) {
				    this.mescroll.resetUpScroll();
				}
			},	

				
			
			
			
			call(no){
				uni.showModal({
					title: '提示',
					content: '你要拨打'+no,
					confirmText: '确定',					
					success: function(res) {
						if (res.confirm) {
						uni.makePhoneCall({
					phoneNumber:no,//电话号码
					success:function(e){
						console.log(e);
					},
					fail:function(e){
						console.log(e);

					}
				})
													
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			
			},
			async hexiaopass(id) {
				let that = this;
				let result = await that.$request({
					loading: 0,
					method: 'post',
					url: '/chat/zuju/hexiaoid',
					data: {
						id:id
					}
				});
			
				if (result.statusCode == 200) {
					that.showma=false
					uni.showModal({
						title: '提示',
						content: result.data.msg,
						confirmText: '知道了',
						showCancel: false,
						success: function(res) {
							if (res.confirm) {
							that.mescroll.resetUpScroll();
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					
				}
			},
					
			
			
			
			sousuo(){
				if (!this.searchKey){
					this.msg('请输入搜索内容')
				return
				}
				this.mescroll.resetUpScroll();
				//this.searchKey=''
			},
			downCallback(mescroll) {
				mescroll.endSuccess();
				mescroll.resetUpScroll();
			},
			async upCallback(mescroll) {
				let that = this;			
				let result = await that.$request({
					loading: 1,
					method: 'get',
					url: '/chat/yuehui/reseverlist',
					data: {
						key:that.searchKey,
						id:that.id,
						page: mescroll.num,					
					}
				});
				if (result.statusCode == 200) {
					if (result.data.code == 200) {
						
						that.baoming=result.data.data.baoming
						that.hexiao=result.data.data.yihexiao
						that.jine=result.data.data.moeny
						that.time_is=result.data.data.time_is
						
						
						that.ti_zhuangtai=result.data.data.ti_zhuangtai
						if (mescroll.num == 1) {
							that.content = result.data.data.data;
						} else {
							that.content = that.content.concat(result.data.data.data);
						}
						mescroll.endSuccess(result.data.data.data.length, result.data.data.data.length >= mescroll
							.size);

					} else {
						uni.showToast({
							icon: 'none',
							title: result.data.msg
						});
					}
				} else {
					uni.showToast({
						icon: 'none',
						title: that.$errorMsg
					});
				}
			},

		}
	}
</script>
<style lang="scss" scoped>
	/* 胶囊*/
	.tn-custom-nav-bar__back {
		width: 100%;
		height: 100%;
		position: relative;
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		box-sizing: border-box;
		background-color: rgba(0, 0, 0, 0.15);
		border-radius: 1000rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.5);
		color: #FFFFFF;
		font-size: 18px;

		.icon {
			display: block;
			flex: 1;
			margin: auto;
			text-align: center;
		}

		&:before {
			content: " ";
			width: 1rpx;
			height: 110%;
			position: absolute;
			top: 22.5%;
			left: 0;
			right: 0;
			margin: auto;
			transform: scale(0.5);
			transform-origin: 0 0;
			pointer-events: none;
			box-sizing: border-box;
			opacity: 0.7;
			background-color: #FFFFFF;
		}
	}

  .logo-image {
    width: 60rpx;
    height: 60rpx;
    position: relative;
    margin-top: -15rpx;
  }

  .logo-pic {
    background-size: cover;
    background-repeat: no-repeat;
    // background-attachment:fixed;
    background-position: top;
    border-radius: 50%;
  }

  /* 自定义导航栏内容 end */

  /* 资讯主图 start*/
  .image-article {
    border-radius: 8rpx;
    border: 1rpx solid #F8F7F8;
    width: 140rpx;
    height: 140rpx;
    position: relative;
  }

  .image-pic {
    background-size: cover;
    background-repeat: no-repeat;
    // background-attachment:fixed;
    background-position: top;
    border-radius: 10rpx;
  }

  .article-shadow {
    border-radius: 15rpx;
    box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
  }

  /* 文字截取*/
  .clamp-text-1 {
    -webkit-line-clamp: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .clamp-text-2 {
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  /* 标签内容 start*/
  .tn-tag-content {
    &__item {
      display: inline-block;
      line-height: 35rpx;
      padding: 5rpx 25rpx;

      &--prefix {
        padding-right: 10rpx;
      }
    }
  }

  /* 标签内容 end*/
</style>
